//
//  KLFirstInViewController.m
//  Koala
//
//  Created by 超八机 on 14/11/22.
//  Copyright (c) 2014年 Anonymous. All rights reserved.
//

#import "KLFirstInViewController.h"
#import "KLMainViewController.h"

@interface KLFirstInViewController ()
@property (weak, nonatomic) IBOutlet UIButton *addMagazine;
@property (weak, nonatomic) IBOutlet UILabel *backgroundLabel;

@end

@implementation KLFirstInViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self.backgroundLabel setBackgroundColor:RGBColor16Bit(0x4b89dc)];
    [self.addMagazine setBackgroundImage:[UIImage imageNamed:@"FirstInPageAdd_N"] forState:UIControlStateNormal];
    [self.addMagazine setBackgroundImage:[UIImage imageNamed:@"FirstInPageAdd_P"] forState:UIControlStateHighlighted];
//    UIButton *myCenter = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
//    [myCenter setBackgroundImage:[UIImage imageNamed:@"MyCenterButton_N"] forState:UIControlStateNormal];
//    [myCenter setBackgroundImage:[UIImage imageNamed:@"MyCenterButton_P"] forState:UIControlStateHighlighted];
//    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:myCenter];
    
    [self addRightButton];
}


-( void)addRightButton
{
    UIButton *rightButton = [[UIButton alloc] initWithFrame:CGRectMake(260, 20, 60, 60)];
    [[rightButton titleLabel] setFont:[UIFont systemFontOfSize:13.0f]];
    [rightButton setImage:[UIImage imageNamed:@"btn_person"] forState:UIControlStateNormal];
    [rightButton addTarget:self action:@selector(rightNavButtonClicked) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:rightButton];
}


- (void)rightNavButtonClicked
{
    KLMainViewController * mainController = [[KLMainViewController alloc] init];
    UINavigationController * controller = [[UINavigationController alloc] initWithRootViewController:mainController];
    [self presentViewController:controller animated:YES completion:NULL];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)addMagazineClicked:(id)sender {
}

@end
